{% extends "base.html" %} {% block title %}优惠券浏览{% end %}


{% block sub %}
<!--  START SUB NAV -->
    
    <!-- the class "active" is used to highlight the current/active linke -->
	<div id="subnav">
        <ul>
            <li><a href="/home/" >创建优惠券</a></li>
            <li><a href="/coupon/" class="active">优惠券管理</a></li>
        </ul>
    </div><!--  end div #subnav -->
    <!--  END SUB NAV -->    
{% end %}


{% block content %}
    
    <div id="primary_content">
        
        <h3>优惠券浏览</h3>
            <div id="tabs">
                <ul>
                    <li{% if t == '0' %} class="active"{% end %}><a href="/coupon/view/{{ coupon['uid'] }}/?t=0">已领取</a></li>
                    <li{% if t != '0' %} class="active"{% end %}><a href="/coupon/view/{{ coupon['uid'] }}/?t=1">未领取</a></li>
                </ul>
                <div id="tabs-1">
                    <table id="myTable">
                        <thead>
                            <tr>
                                <th>代码</th>
                                <th>有效日期</th>
				<th>淘宝账号</th>
				<th>是否领取</th>
				<th>领取日期</th>
                            </tr>
                        </thead>
                        <tbody>
                            {% for u in codes %}
                            <tr>
                                <td>{{ u['uid'] }}</td>
				<td>{{ u.get('valid', '无') }}</td>
				<td>{{ u.get('tb_name', '无') }}</td>
                                <td>{% if u.get('applied') and u.get('applied')==True %}是{% else %}否{% end %}</td>
				<td>{{ u.get('applied_date', '无') }}</td>
                            </tr>
                            {% end %}
                        </tbody>
                    </table>
                </div>
            </div>
	    {{ page.pager('~2~ <span class="fade">(第 $page 页, 共 $page_count 页)</span>') }}
    </div>

{% end %}